﻿/*
 * @Autor: PK
 * @Date: 2022/01/14 22:15:SS
 */

using System.Collections.Generic;
using ShkSimulation.core.dao.statistic;
using ShkSimulation.carsharing;
using ShkSimulation.core.template.customer;
using ShkSimulation.core.template.model;

namespace ShkSimulation.carsharing.demo {

	public class DemoRoad: CarsharingRoad {
		
		public int ArriveCount { get; set; }
		
		public int LastStation { get; set; }
		public int NextStation { get; set; }

		public DemoRoad(BaseAgencyParams agencyParams) : base(agencyParams) {
		}

		public override ServiceRateHelper ServiceRateHelper { get; set; }
		public int VehicleCount { get; private set; }

		public override DataReportInfo GetReportInfo() {
			return DataReportInfo.Create(UniqueId.ToString(), ClockTime, null, new Dictionary<string, double>(){ {"ArriveCount", ArriveCount} });
		}

		public override void TravelerArrive(CarsharingTraveler customer) {
			ArriveCount++;
			VehicleCount++;
			DemoTraveler traveler = customer as DemoTraveler;
			InternalServe(traveler);
		}

		public override void TravelerServe(CarsharingTraveler customer) {
			ScheduleDepart(customer, ServiceRateHelper.GetAverageServiceTime());
		}

		public override void TravelerDepart(CarsharingTraveler customer) {
			VehicleCount--;
			customer.EnterNextAgency();
		}

	}

}